package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:张熳
 * Date:2025-08-23
 * Time:19:50
 */
//测试继承

public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog();
        //dog类中并没有定义任何成员变量，name和age属性是从父类Animal中继承下来的
        System.out.println(dog.name);
        System.out.println(dog.age);

        //dog访问的eat()方法也是从Animal中继承下来的
        dog.eat();
        dog.bark();
    }
}


